package com.ruoyi.web.controller.drinkwater;

import java.util.List;
import javax.servlet.http.HttpServletResponse;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.drinkwater.domain.BusWaterDrinksourceProjectlist;
import com.ruoyi.drinkwater.service.IBusWaterDrinksourceProjectlistService;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;

/**
 * [项目工程清单]Controller
 * 
 * @author ruoyi
 * @date 2025-09-03
 */
@RestController
@RequestMapping("/drink/projectlist")
public class BusWaterDrinksourceProjectlistController extends BaseController
{
    @Autowired
    private IBusWaterDrinksourceProjectlistService busWaterDrinksourceProjectlistService;

    /**
     * 查询[项目工程清单]列表
     */
//    @PreAuthorize("@ss.hasPermi('system:PROJECTLIST:list')")
    @GetMapping("/list")
    public TableDataInfo list(BusWaterDrinksourceProjectlist busWaterDrinksourceProjectlist)
    {
        startPage();
        List<BusWaterDrinksourceProjectlist> list = busWaterDrinksourceProjectlistService.selectBusWaterDrinksourceProjectlistList(busWaterDrinksourceProjectlist);
        return getDataTable(list);
    }

    /**
     * 导出[项目工程清单]列表
     */
//    @PreAuthorize("@ss.hasPermi('system:PROJECTLIST:export')")
//    @Log(title = "[项目工程清单]", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, BusWaterDrinksourceProjectlist busWaterDrinksourceProjectlist)
    {
        List<BusWaterDrinksourceProjectlist> list = busWaterDrinksourceProjectlistService.selectBusWaterDrinksourceProjectlistList(busWaterDrinksourceProjectlist);
        ExcelUtil<BusWaterDrinksourceProjectlist> util = new ExcelUtil<BusWaterDrinksourceProjectlist>(BusWaterDrinksourceProjectlist.class);
        util.exportExcel(response, list, "[项目工程清单]数据");
    }

    /**
     * 获取[项目工程清单]详细信息
     */
//    @PreAuthorize("@ss.hasPermi('system:PROJECTLIST:query')")
    @GetMapping(value = "/getInfo/{id}")
    public AjaxResult getInfo(@PathVariable("id") String id)
    {
        return success(busWaterDrinksourceProjectlistService.selectBusWaterDrinksourceProjectlistById(id));
    }

    /**
     * 新增[项目工程清单]
     */
//    @PreAuthorize("@ss.hasPermi('system:PROJECTLIST:add')")
//    @Log(title = "[项目工程清单]", businessType = BusinessType.INSERT)
    @PostMapping("/add")
    public AjaxResult add(@RequestBody BusWaterDrinksourceProjectlist busWaterDrinksourceProjectlist)
    {
        return toAjax(busWaterDrinksourceProjectlistService.insertBusWaterDrinksourceProjectlist(busWaterDrinksourceProjectlist));
    }

    /**
     * 修改[项目工程清单]
     */
//    @PreAuthorize("@ss.hasPermi('system:PROJECTLIST:edit')")
//    @Log(title = "[项目工程清单]", businessType = BusinessType.UPDATE)
    @PostMapping("/edit")
    public AjaxResult edit(@RequestBody BusWaterDrinksourceProjectlist busWaterDrinksourceProjectlist)
    {
        return toAjax(busWaterDrinksourceProjectlistService.updateBusWaterDrinksourceProjectlist(busWaterDrinksourceProjectlist));
    }

    /**
     * 删除[项目工程清单]
     */
//    @PreAuthorize("@ss.hasPermi('system:PROJECTLIST:remove')")
//    @Log(title = "[项目工程清单]", businessType = BusinessType.DELETE)
	@GetMapping("/remove/{ids}")
    public AjaxResult remove(@PathVariable String[] ids)
    {
        return toAjax(busWaterDrinksourceProjectlistService.deleteBusWaterDrinksourceProjectlistByIds(ids));
    }
}
